﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using JKF.Substructure;
using System.Text;

namespace JKF.Web.Customer.DicLevel
{
    public partial class Level_Add : PageBase
    {
        /// <summary>
        /// 产品折扣率
        /// </summary>
        protected string PRODUCT_DISCOUNT
        {
            get
            {
                return GetDiscount();
            }
        }
        /// <summary>
        /// 礼品折扣率
        /// </summary>
        protected string POINT_DISCOUNT
        {
            get
            {
                return GetDiscount();
            }
        }
        /// <summary>
        /// 获取折扣率
        /// </summary>
        /// <returns></returns>
        private static string GetDiscount()
        {
            List<string> discount = SysConfig.Discount.ToList();
            StringBuilder sb = new StringBuilder();
            try
            { 
                sb.AppendFormat("<option value=\"-1\">请选择</option>");
                for (int i = 0; i < discount.Count; i++)
                {
                    if (discount[i] == "1.00")
                    {
                        sb.AppendFormat("<option value=\"{0}\">{1}</option>", discount[i].Trim(), "不打折");
                        continue;
                    }
                    sb.AppendFormat("<option value=\"{0}\">{1}</option>", discount[i].Trim(), (Convert.ToDouble(discount[i]) * 10) + "折");
                }
                
            }catch( Exception ex)
            {
                AppLogger.Log("读取折扣率配置出错：",ex);
            }
            return sb.ToString();
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            MODULE_NAME_EN = "DIC_LEVEL";
        }
    }
}